unit Unit1; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
  Buttons, StdCtrls, ExtCtrls, process, TAGraph;

type

  { TfrmMain }

  TfrmMain = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    lbSpeed: TLabel;
    lbCurrentFile: TLabel;
    Label4: TLabel;
    lbTime: TLabel;
    Label6: TLabel;
    lbFiles: TListView;
    Memo1: TMemo;
    OpenDialog1: TOpenDialog;
    PageControl1: TPageControl;
    btnAdd: TSpeedButton;
    btnDel: TSpeedButton;
    btnClear: TSpeedButton;
    btnUpload: TSpeedButton;
    btnAbout: TSpeedButton;
    ProgressBar1: TProgressBar;
    tbInfo: TTabSheet;
    tbLinks: TTabSheet;
    tbOptions: TTabSheet;
    TrayIcon1: TTrayIcon;
    procedure btnAddClick(Sender: TObject);
    procedure btnClearClick(Sender: TObject);
    procedure btnDelClick(Sender: TObject);
  private
    { private declarations }
    procedure AddFile(Filename: String);
  public
    { public declarations }
  end; 

var
  frmMain: TfrmMain;

implementation

{ TfrmMain }

procedure TfrmMain.btnAddClick(Sender: TObject);
var
   I: Integer;
   AddedFiles: TStrings;
begin
  OpenDialog1.Execute;
  AddedFiles := OpenDialog1.Files;
  
  for I := 0 to (AddedFiles.Count - 1) do
  begin
    AddFile(AddedFiles.Strings[I]);
  end;
end;

procedure TfrmMain.btnClearClick(Sender: TObject);
begin
  lbFiles.Items.Clear;
  TrayIcon1.Hint:= 'OMGWTF';
end;

procedure TfrmMain.btnDelClick(Sender: TObject);
begin
   if (lbFiles.ItemFocused = nil) then
      Exit
   else
      lbFiles.ItemFocused.Delete;
end;

procedure TfrmMain.AddFile(Filename: String);
var
  Item: TListItem;
begin
  Item := lbFiles.Items.Add;
  Item.Caption := ExtractFileName(FileName);
  Item.SubItems.Add('N/A');
  Item.SubItems.Add('Waiting');
  Item.SubItems.Add(ExtractFilePath(FileName));
end;

initialization
  {$I unit1.lrs}

end.

